class Dog {
    public String name;
    public String color;
    public int age;

    public void eat() {
        System.out.println(name + "吃东西");
    }

    public void wag() {
        System.out.println(name + "摇尾巴");
    }
}
class myValue1 {
    public int val;
}
class myValue2 {
    public int val;
}

public class Test {
    public static void swap(myValue1 val1,myValue2 val2) {
        int tmp = val1.val;
        val1.val = val2.val;;
        val2.val = tmp;
    }
    public static void main(String[] args) {
        myValue1 val1 = new myValue1();
        val1.val = 10;
        myValue2 val2 = new myValue2();
        val2.val = 20;
        System.out.println("交换前");
        System.out.println(val1.val);
        System.out.println(val2.val);
        swap(val1,val2);
        System.out.println("交换后");
        System.out.println(val1.val);
        System.out.println(val2.val);

      /*  Dog dog = new Dog();
        dog.name = "旺财";
        dog.color = "金毛";
        dog.age = 3 ;
        System.out.println(dog.name);
        System.out.println(dog.color);
        System.out.println(dog.age);
        dog.eat();
        dog.wag();*/

       /* Dog dog1 = new Dog();
        dog1 = new Dog;
        dog1 = new Dog;
        dog1 = new Dog;
        dog1 = new Dog;*/

    }

}
